terraform {
   required_providers {
        azurerm = {
        source  = "hashicorp/azurerm"
        version = "= 2.91.0"
        }
    }
}

provider "azurerm" {
  features {}
  subscription_id = var.az_subcription_id
  client_id       = var.az_dep_client_id
  client_secret   = var.az_dep_client_secret
  tenant_id       = var.az_tenant_id
}

resource "azurerm_resource_group" "test" {
  name     = var.az_resourcegroup
  location = var.az_region
}

module "aks" {
  source              = "./modules/aks"
  resource_group_name = var.az_resourcegroup
  location            = var.az_region
  depends_on = [azurerm_resource_group.test]
  
}

module "vnet" {
  source              = "./modules/network"
  resource_group_name = var.az_resourcegroup
  location            = var.az_region
  depends_on = [azurerm_resource_group.test]
}

module "linuxservers" {
  source              = "Azure/compute/azurerm"
  resource_group_name = var.az_resourcegroup
  location            = var.az_region
  vm_os_simple        = "UbuntuServer"
  public_ip_dns       = ["linsimplevmips"] // change to a unique name per datacenter region
  vnet_subnet_id      = module.vnet.vnet1_id

  depends_on = [azurerm_resource_group.test]
}





